<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<center>
		<table>
			<tr>
				<td>用户名:</td>
				<td><input type="text" name="name" id="name"></td>
			</tr>
			<tr>
				<td>密码:</td>
				<td><input type="password" name="pwd" id="pwd"></td>
			</tr>
			<tr>
				<td><button id="dl">登录</button></td>
			</tr>
		</table>
	</center>
</body>
</html>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
	$(document).on("click","#dl",function(){

		//接值
		var name=$("#name").val();
		var pwd=$("#pwd").val();

		$.ajax({

			url:"login.php",
			type:"post",
			data:{name:name,pwd:pwd},
			dataType:"json",
			success:function(res)
			{
              if(res.code==1)
              {
              	alert(res.mes);
              	location.href="show.php";
              }
			}
		})
	})
</script>